1. Field of the Invention
The present invention relates to a data processing method and a data processing apparatus, particularly to a data processing method and a data processing apparatus preferably used in, for example, an IC (Integrated Circuit) card or the like where transmission and reception of data is carried out in a non-contact state.
2. Description of Related Art
There has been developed an IC card (smart card) which is expected to use in an electronic money system or a security system.
An IC card incorporates CPU (Central Processing Unit) for carrying out various kinds of processes and a memory for storing data or the like necessary for processing in which transmission and reception of data is carried out in a state where the IC card is brought into contact with a predetermined reader/writer (R/W).
Meanwhile, there is an IC card of a batteryless type having no battery of its own in IC card and power is supplied from R/W to such an IC card of a batteryless type.
Further, there is an IC card which carries out transmission and reception of data between the IC card and R/W in a non-contact state by using an electromagnetic wave and obtains necessary power by the electromagnetic wave.
However, in the case of carrying out transmission and reception of data between an IC card and R/W in a non-contact state, there poses a problem in which sufficient power cannot be provided when the reception state of electromagnetic wave is failed in the midst of making access to a memory incorporated in the IC card and a defect is caused in the compatibility of data in the memory (Memory Corruption is caused).
Further, when transmission and reception of data is carried out by bringing the IC card into contact with R/W, in the case where a user can freely insert or draw the IC card to or from R/W, if the IC card is drawn from R/W in the midst of making access to a memory, the memory corruption may also be caused.
In this case, when data is held at each unit (sector in the case of MS-DOS) for storing data as in, for example, FAT (File Allocation Table) of MS-DOS (Microsoft-Disc Operating System) (registered trademark), in the case where memory corruption is caused in FAT, all the positional information of data (file) is lost and access to data cannot be made.
Accordingly, when memory corruption is caused, in the worst case, an IC card cannot be used and therefore, some countermeasure is needed in respect of the memory corruption.
Furthermore, in the case of an IC card, data is read and written by a unit of a predetermined block and therefore, a plurality of related data may be written respectively to a plurality of blocks. That is, for example, when an IC card is used as an electronic money or the like for paying carfare, there may be a case where log (use history) is intended to store. Further, now, for example, when related information of station and time to get in train, station and time to get off train, fare between stations to get in and off train and the like are stored as a log, the related information may be written by dividing the information into a plurality of blocks. Therefore, in such a case, it is necessary not only to deal with memory corruption in respect of a single block but deal with memory corruption when the memory corruption is caused in any of a plurality of blocks where the related data is written.
The present invention has been carried out in view of such a situation and the present invention can effectively deal with memory corruption.
According to a first aspect of the present invention of an information processing method, data to be written to one or more of the blocks in the data region in correspondence with the block numbers stored to either one region of the first and the second region, is written to one or more of updating blocks for updating data in the blocks constituting the data region and block numbers of blocks which have been the updating blocks to which the data has been written are stored to other of the first and the second region.
According to a second aspect of the present invention of an information processing apparatus, there are provided data writing means for writing data to be written to one or more of the blocks of the data region in correspondence with the block numbers stored to either one region of the first and the second region to one or more of updating blocks for updating data in the blocks constituting the data region, and block number writing means for storing the block numbers of the blocks which have been the updating blocks to which the data has been written to other of the first and the second region.
According to the first and the second aspects of the information processing method and the information processing apparatus, data to be written to one or more of the blocks in the data region in correspondence with the block numbers stored to either one region of the first and the second region, is written to one or more of updating blocks for updating data in the blocks constituting the data region and block numbers of blocks which have been the updating blocks to which the data has been written are stored to other of the first and the second region. Accordingly, memory corruption can be dealt with effectively not only in the case of writing data to one block but in the case of writing data to a plurality of blocks.
According to a third aspect of an information processing method, data to be written to one or more of the blocks of the data region in correspondence with the block numbers stored to the blocks of the block number region in correspondence with the block numbers stored to either one region of the first and the second region is written to one or more of updating blocks for updating data in the blocks constituting the data region, the block numbers of the blocks which have been the updating blocks of the data region to which the data has been written are written to updating blocks for updating the block numbers in the blocks constituting the block number region, and the block numbers of the blocks which have been the updating blocks in the block number region to which the block numbers have been written are stored to other of the first and the second region.
According to a fourth aspect of an information processing apparatus, there are provided data writing means for writing data to be written to one or more of the blocks of the data region in correspondence with the block numbers stored to the blocks of the block number region in correspondence with the block numbers stored to either one region of the first and the second region to one or more of updating blocks for updating data in the blocks constituting the data region, first block number writing means for writing the block numbers of the blocks which have been the updating blocks of the data region to which the data has been written to the updating blocks for updating block numbers in the blocks constituting the block number region, and second block number writing means for making other of the first and the second region store the block numbers of the blocks which have been the updating blocks of the block number region to which the block numbers have been written.
According to the third aspect of the data processing method and the fourth aspect of the data processing apparatus, data to be written to one or more of the blocks of the data region in correspondence with the block numbers stored to the blocks of the block number region in correspondence with the block numbers stored to either one region of the first and the second region is written to one or more of updating blocks for updating data in the blocks constituting the data region, the block numbers of the blocks which have been the updating blocks of the data region to which the data has been written are written to updating blocks for updating the block numbers in the blocks constituting the block number region, and the block numbers of the blocks which have been the updating blocks in the block number region to which the block numbers have been written are stored to other of the first and the second region. Accordingly, memory corruption can effectively be dealt with even in the case where data is written to further many blocks.